﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using MyApp.Infrastructure.Commanding;
using MyApp.Infrastructure.Messages;
using Microsoft.Practices.ServiceLocation;
using MyApp.Modules.Orders.Views;
using MVVMFramework.Messaging;
using MyApp.Data.Model;

namespace MyApp.Modules.Orders.Menu
{
    public class Commands
    {
        public static ICommand NewOrderCommand = new ActionCommand(Commands.NewOrder);
        public static ICommand ViewOrdersCommand = new ActionCommand(Commands.ViewOrders);


        private static void NewOrder()
        {
            Messenger.Get<CreateViewMessage>().Publish(new CreateViewMessageArgs
            {
                View = new Lazy<object>(() => ServiceLocator.Current.GetInstance<OrderView>()),
                Position = ViewPosition.Center,
                Title = "New Order"
            });
        }

        private static void ViewOrders()
        {
            Messenger.Get<SearchTaskMessage>().Publish(new SearchTaskMessageArgs<Product>());
        }
    }
}
